<template>
  <div class="form-subform-preview">
    <div class="form-preview-group">
      <label>
        {{ _displayName }}
        <span class="form-preview-notNull" v-if="field.isNull == 0">*</span>
      </label>
      <div class="form-preview-mock">
        <span class="form-type-text">{{ $t('common.form.preview.materialsBill.subForm') }}</span>
      </div>
    </div>

    <div class="form-subform-preview-content">
      <!-- start 关联显示字段 -->
      <div class="form-subform-preview-title">{{ $t('common.form.preview.materialsBill.relatedShowField') }}</div>
      <div class="form-preview">
        <div class="form-design-preview" v-for="item in subformFields" :key="item.fieldName">
          <div class="form-preview-group">{{ returnDisplayName(item) }}</div>
        </div>
      </div>
      <!-- end 关联显示字段 -->
    </div>
  </div>
</template>

<script>
/* props */
import { previewProps } from '@src/component/form/components/props';
import translate from '@src/component/form/mixin/translate.js';

export default {
  name: 'form-product-warranty-service-preview',
  props: previewProps,
  mixins: [translate],
  computed: {
    /** 物料清单关联字段 */
    subformFields() {
      return this.field?.subFormFieldList || [];
    },
  },
};
</script>

<style lang="scss" scoped>
@import '@src/component/form/components/FormSubForm/FormSubForm.scss';
</style>


